﻿using UnityEngine;
using System.Collections;

public class MovingPlatform : MonoBehaviour {

	public bool suunta = false;
	

	void Update () {

		if(suunta == false)
			rigidbody2D.velocity = new Vector3(-1f,0f,0f);
		else
			rigidbody2D.velocity = new Vector3(1f,0f,0f);

	}

	void OnTriggerEnter2D()
	{
		suunta = !suunta;
	}
}
